package name.nano.client.utils;



import java.io.Serializable;

import com.google.gwt.user.client.rpc.IsSerializable;

public class Coordinate implements IsSerializable, Serializable {
	
    private String key;


	public double x;
	public double y;
	
	public Coordinate() {
	}
	
	public void setX(double x) {
		this.x = x;
	}
	public double getX() {
		return x;
	}
	public void setY(double y) {
		this.y = y;
	}
	public double getY() {
		return y;
	}
	public Coordinate(double x, double y) {
		super();
		this.x = x;
		this.y = y;
	}
	public double distance(Coordinate downEv) {
		double dx = x-downEv.x;
		double dy = y-downEv.y;
		return Math.sqrt(dx*dx+dy*dy);
	}
	@Override
	public int hashCode() {
		return (int) x;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Coordinate other = (Coordinate) obj;
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		return true;
	}


	

}
